package com.systop.cardecorate.admin.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.systop.common.validator.group.AddGroup;
import com.systop.common.validator.group.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * 
 * 
 * @author jsj
 * @email jsj@gmail.com
 * @date 2022-05-05 11:46:06
 */
@Data
@TableName("payment_admin")
public class AdminEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 用户id
	 * 添加时id必须为空
	 * 修改时id不能为空
	 */
	@TableId
	@Null(groups = {AddGroup.class},message = "添加用户时,id必须为空")
	@NotNull(groups = {UpdateGroup.class},message = "修改用户时,id不能为空")
	private Integer id;
	/**
	 * 用户名称
	 * 添加时memberName不能为空(包含空格)
	 */
	@NotBlank(groups = {AddGroup.class},message = "用户名不能为空(也不能包含空格)")
	@Null(groups = {UpdateGroup.class},message = "不能修改用户名!")
	private String memberName;
	/**
	 * 用户密码
	 * 添加时memberPass不能为空(包含空格)
	 */
	@NotBlank(groups = {AddGroup.class},message = "密码不能为空(也不能包含空格)")
	private String memberPass;

	/**
	 *	确认密码
	 */
	@TableField(exist = false)
	// @NotBlank(groups = {UpdatePass.class},message = "修改密码时，确认密码不能为空")
	private String confirmPass;

	/**
	 * 用户权限
	 * 添加时role不能为空
	 */
	// @Pattern(regexp = "^[0-2]$",message = "用户权限不合法")
	@NotNull(groups = {AddGroup.class},message = "用户权限不能为空")
	private Integer role;

	/**
	 * 盐
	 */
	@Null(groups = {AddGroup.class,UpdateGroup.class},message = "添加或修改密码失败")
	private String salt;
}
